package it.univaq.mwt.tp;

import java.io.Serializable;
import java.lang.String;
import java.util.Collection;
import java.util.HashSet;

import javax.persistence.*;

import static javax.persistence.FetchType.EAGER;
import static javax.persistence.CascadeType.PERSIST;
import static javax.persistence.CascadeType.REFRESH;

/**
 * Entity implementation class for Entity: Department
 * 
 */
@Entity
public class Department implements Serializable {

	private String name;
	private Collection<Employee> employees = new HashSet<Employee>();
	private static final long serialVersionUID = 1L;

	public Department() {
		super();
	}

	public Department(String name) {
		this.name = name;
	}

	@Id
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(fetch = EAGER, cascade = { PERSIST, REFRESH })
	public Collection<Employee> getEmployees() {
		return this.employees;
	}

	public void setEmployees(Collection<Employee> employees) {
		this.employees = employees;
	}

	public void addEmployee(Employee employee) {
		employees.add(employee);
	}

}
